/*
    利用react-router-config配置路由
*/
import React from 'react';
import { Redirect } from 'react-router-dom';
import Home from '../application/home';
import Recommend from '../application/recommend';
import Singers from '../application/singers';
import Rank from '../application/rank';
import Album from '../application/album';
import Singer from '../application/singer';

const routes =  [
    {
        path:'/',
        component: Home,
        routes: [
            {
                path:'/',
                exact: true,
                render: () => (
                    <Redirect to={'/recommend'}/>
                ),
                routes: [
                    {
                        path: '/recommend/:id',
                        component: Album,
                    }
                ],
            },
            {
                path: '/recommend',
                component: Recommend,
                routes: [
                    {
                        path: '/recommend/:id',
                        component: Album,
                    }
                ],
            },
            {
                path: '/singers',
                component: Singers,
                routes: [
                    {
                        path: '/singers/:id',
                        component: Singer,
                    }
                ],
            },
            {
                path: '/rank',
                component: Rank,
                routes: [
                    {
                        path:'/rank/:id',
                        component: Album,
                    }
                ],
            },
        ],
    },
];

export default routes;